<!--
 * @Description: 课程详情-list组件
 * @Author: 老五 13521685612@163.com
 * @Date: 2024-11-09 14:44:32
 * @LastEditors: 老五 13521685612@163.com
 * @LastEditTime: 2024-11-21 19:54:58
 * @FilePath: /lieshou-app/components/z-catalogue-list.vue
-->

<template>
	<view>
		<view v-if="type==='list'">
			<!-- @click="getItem(item,index)" -->
			<view class="course-list-box" v-for="(item,index) in list" 
				:style="current===index?'border: 4rpx solid rgba(252, 208, 231, 1)':''">
				<block v-if="!has_rights||has_rights==='false'">
					<view class="course-list-box-title">{{item.title}}</view>
					<view class="course-list-box-flex"  >
						<view class="pup-list-name">
							<view class="pup-active"></view>
							<view class="pup-box-name">适用实践场景：{{item.desc}}</view>
						</view>
						<!-- @click="getBtnItem(item,index,'isMember')" -->
						<view class="course-btn"  
						v-if="isMember&&current!=index" :style="current!=index?'background:rgba(0, 0, 0, 1);':''" 
						 @click="getItem(item,index)">开始学习
						</view>
						<!-- <view class="course-btn" v-else @click="getBtnItem(item,index,'noIsMember')">开始学习</view> -->
					</view>
					<block >
						<view class="course-list-label" v-for="(items,indexs) in item.contents">{{items.title}}</view>
					</block>
				</block>
				<!--  -->
				<block v-if="has_rights">
					<view class="course-list-box-title">{{item.title}}</view>
					<view class="press-box" v-if="current==index">完成度： {{item.learn_time}}%</view>
					<view class="start-box" v-if="current==index">正在学习</view>
					<view class="course-list-box-flex"  v-if="current!=index">
						<view class="pup-list-name">
							<view class="pup-active"></view>
							<view class="pup-box-name">适用实践场景：{{item.desc}}</view>
						</view>
						<!-- @click="getBtnItem(item,index,'isMember')" -->
						<view class="course-btn"  
						v-if="isMember&&current!=index" :style="current!=index?'background:rgba(0, 0, 0, 1);':''" 
						 @click="getItem(item,index)">开始学习
						</view>
						<!-- <view class="course-btn" v-else @click="getBtnItem(item,index,'noIsMember')">开始学习</view> -->
					</view>
					<block v-if="current!=index">
						<view class="course-list-label" v-for="(items,indexs) in item.contents">{{items.title}}</view>
					</block>
				</block>
			</view>
			<view class="gaps"></view>
		</view>
		<view v-if="type==='details'">
			<view class="course-list-box" style="border: 4rpx solid rgba(252, 208, 231, 1)">
				<view class="course-list-box-title">{{coursesIns.contents.title}}</view>
				<view class="course-list-box-flex">
					<view class="pup-list-name">
						<view class="pup-active"></view>
						<view class="pup-box-name">适用实践场景：{{coursesIns.contents.title}}</view>
					</view>
					<view class="course-btn" style="background:rgba(0, 0, 0, 1);">开始学习</view>
				</view>
				<view class="course-list-label" v-for="(items,indexs) in coursesIns.contents.contents">{{items.title}}
				</view>
			</view>
			<view class="gaps"></view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "z-catalogue-list",
		props: ['list', 'current', 'type', 'coursesIns', 'isMember','has_rights'],
		data() {
			return {

			};
		},
		methods: {
			// 选中
			getItem(item, index) {
				this.$emit('getItem', {
					item: item,
					index: index
				})
			},
			// 点击学习
			getBtnItem(item,index,type){
				if(type==='noIsMember'){
					this.$utils.showToast('您还不是会员～',1000)
				}else{
					this.$utils.showLog('点击学习按钮',item)
				}
			}
		}

	}
</script>

<style lang="scss">
	page {

		background-image: url('https://1257557568.vod-qcloud.com/d34b21d5vodcq1257557568/7b1391ad1397757896686948962/ERawiiRPGZkA.png');
		background-repeat: no-repeat;
		background-size: 100% 100%;
	}

	.course-list-box {
		width: 690rpx;
		margin: 0 auto;
		background-color: #fff;
		padding-bottom: 30rpx;
		border-radius: 20rpx;
		margin-bottom: 25rpx;
		position: relative;
		background: rgba(255, 255, 255, 1);
		border: 2rpx solid rgba(235, 236, 237, 1);
.press-box{
	width: 200rpx;
	margin-top: 20rpx;
	margin-left: 86rpx;
font-size: 24rpx;
font-weight: 500;
color: rgba(0, 0, 0, 1);
}
// 正在学习
.start-box{
	position: absolute;
	right: 30rpx;
	top: 40rpx;
	font-size: 24rpx;
	color: #333;
}
		.course-list-label {
			font-size: 24rpx;
			font-weight: 500;
			margin-left: 30rpx;
			margin-bottom: 21rpx;
		}

		.course-list-box-title {
			/** 文本1 */
			font-size: 28rpx;
			font-weight: 500;
			color: rgba(0, 0, 0, 1);
			margin-top: 26rpx;
			margin-left: 30rpx;
			text-align: left;
			width: 520rpx;
			  overflow: hidden;
			  display: -webkit-box; /* 将对象作为弹性伸缩盒子模型显示 */
			  -webkit-line-clamp: 2; /* 行数，值可以改，表示展示X行后多余的缩略展示 */
			  -webkit-box-orient: vertical; /* 设置或检索伸缩盒对象的子元素的排列方式 */
			  word-break: break-all;
			vertical-align: top;
		}

		.course-list-box-flex {
			display: flex;
			align-items: center;
			margin-left: 26rpx;
			margin-top: 26rpx;
			justify-content: space-between;
			margin-bottom: 100rpx;

			.pup-list-name {
				display: flex;
				position: relative;
				width: 400rpx;

				.pup-active {
					width: 32rpx;
					height: 32rpx;
					opacity: 1;
					will-change: transform, filter;
					background: linear-gradient(128.84deg, rgba(253, 145, 200, 1) 0%, rgba(255, 255, 255, 0) 100%);
					filter: blur(10rpx);

				}

				.pup-box-name {
					/** 文本1 */
					width: auto;
					position: absolute;
					left: 10rpx;
					color: rgba(0, 0, 0, 1);
					text-align: left;
					vertical-align: top;

					font-size: 20rpx;
					font-weight: 300;
				}
			}

			.course-btn {
				width: 148rpx;
				height: 48rpx;
				line-height: 48rpx;
				border-radius: 34rpx;
				text-align: center;
				margin-right: 18rpx;
				background: rgba(217, 217, 217, 1);
				align-items: center;
				opacity: 1;
				font-size: 24rpx;
				font-weight: 500;
				color: rgba(255, 255, 255, 1);
			}

		}
	}
</style>